/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package form.components;

import com.sun.lwuit.Component;
import com.sun.lwuit.Label;
import com.sun.lwuit.List;
import com.sun.lwuit.list.ListCellRenderer;
import com.sun.lwuit.plaf.Border;
import domain.model.IRegistro;
import view.img.ImageStore;

/**
 *
 * @author ademar.victorino
 */
public class RegistroListRenderer extends Label implements ListCellRenderer {

    public Component getListCellRendererComponent(List list, Object value, int index, boolean isSelected) {
        setText(((IRegistro) value).getNome());
        this.getStyle().setBorder(Border.createRoundBorder(4, 2));
        
        setIcon(ImageStore.getInstance().getImage("registro"));

        if (isSelected) {
            getStyle().setBgColor(0xffcc66);
        } else {
            getStyle().setBgColor(0xcccccc);
        }

        return this;
    }

    public Component getListFocusComponent(List list) {
        Label label = new Label("");
        label.getStyle().setBgTransparency(100);
        return label;
    }
}
